package avicit.bdp.dgs.standard.dto;

import avicit.bdp.common.base.BaseDTO;
import avicit.platform6.core.annotation.log.FieldRemark;
import avicit.platform6.core.annotation.log.LogField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.Column;
import javax.persistence.Table;
import java.util.Objects;

/**
 * @author mayi
 * 数据标准-码表-代码信息
 */
@ApiModel(value = "LookupTableValueDto", description = "码表-代码信息")
@Table(name = "bdp_dgs_lookup_table_values")
public class LookupTableValueDto extends BaseDTO {

	private static final long serialVersionUID = 1L;

	/**
	 * 主键ID
	 */
	@LogField
	@ApiModelProperty(value = "主键")
	@FieldRemark(column = "id", field = "id", name = "主键")
	@Column(name = "id")
	@avicit.platform6.core.annotation.log.Id
	@javax.persistence.Id
	private String id;


	/**
	 * 代码表主键
	 */
	@LogField
	@ApiModelProperty(value = "代码表主键", name = "lookupTableId")
	@FieldRemark(column = "lookup_table_id", field = "lookupTableId", name = "代码表主键")
	private String lookupTableId;

	/**
	 * 代码值
	 */
	@Excel(name = "*代码", orderNum = "1", width = 15)
	@LogField
	@ApiModelProperty(value = "代码值", name = "value")
	@FieldRemark(column = "value", field = "value", name = "代码值")
	private String value;

	/**
	 * 中文名称
	 */
	@Excel(name = "*代码名称", orderNum = "2", width = 15)
	@LogField
	@ApiModelProperty(value = "中文名称", name = "name")
	@FieldRemark(column = "name", field = "name", name = "中文名称")
	private String name;

	/**
	 * 英文名称
	 */
	@LogField
	@ApiModelProperty(value = "英文名称", name = "enName")
	@FieldRemark(column = "en_name", field = "enName", name = "英文名称")
	private String enName;

	/**
	 * 含义
	 */
	@Excel(name = "*代码含义", orderNum = "3", width = 15)
	@LogField
	@ApiModelProperty(value = "含义", name = "remark")
	@FieldRemark(column = "remark", field = "remark", name = "含义")
	private String remark;

	/**
	 * 显示顺序
	 */
	@LogField
	@ApiModelProperty(value = "显示顺序", name = "displayOrder")
	@FieldRemark(column = "display_order", field = "displayOrder", name = "显示顺序")
	private Integer displayOrder;

	@Override
	public String getLogFormName() {
		if (avicit.platform6.commons.utils.StringUtils.isEmpty(super.logFormName)) {
			return "值域标准模块";
		} else {
			return super.logFormName;
		}
	}

	@Override
	public String getLogTitle() {
		if (avicit.platform6.commons.utils.StringUtils.isEmpty(super.logTitle)) {
			return "值域标准";
		} else {
			return super.logTitle;
		}
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getLookupTableId() {
		return lookupTableId;
	}

	public void setLookupTableId(String lookupTableId) {
		this.lookupTableId = lookupTableId;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEnName() {
		return enName;
	}

	public void setEnName(String enName) {
		this.enName = enName;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public Integer getDisplayOrder() {
		return displayOrder;
	}

	public void setDisplayOrder(Integer displayOrder) {
		this.displayOrder = displayOrder;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}
		LookupTableValueDto that = (LookupTableValueDto) o;
		return Objects.equals(getId(), that.getId()) &&
				Objects.equals(getLookupTableId(), that.getLookupTableId()) &&
				Objects.equals(getValue(), that.getValue()) &&
				Objects.equals(getName(), that.getName()) &&
				Objects.equals(getEnName(), that.getEnName()) &&
				Objects.equals(getRemark(), that.getRemark()) &&
				Objects.equals(getDisplayOrder(), that.getDisplayOrder());
	}

	@Override
	public int hashCode() {
		return Objects.hash(getId(), getLookupTableId(), getValue(), getName(), getEnName(), getRemark(), getDisplayOrder());
	}

	@Override
	public String toString() {
		return "LookupTableValueDto{" +
				"id='" + id + '\'' +
				", lookupTableId='" + lookupTableId + '\'' +
				", value='" + value + '\'' +
				", name='" + name + '\'' +
				", enName='" + enName + '\'' +
				", remark='" + remark + '\'' +
				", displayOrder=" + displayOrder +
				'}';
	}
}
